<template>
  <el-dialog v-model="dialogFormVisible" title="定时发布" width="500" destroy-on-close>
    <div class="block">
      <el-time-picker v-model="time" placeholder="Arbitrary time" />
    </div>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取消</el-button>
        <el-button type="primary" @click="confirmClick"> 定时发布 </el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script setup>
import { ref } from 'vue'

const time = ref()
const dialogFormVisible = ref(false)
const emit = defineEmits(['select-time'])

const open = () => {
  dialogFormVisible.value = true
}

const confirmClick = () => {
  emit('select-time', time.value)
  dialogFormVisible.value = false
}

defineExpose({
  open
})
</script>

<style scoped></style>
